﻿@using KRM.Core
@using KRM.Core.Library
@model IEnumerable<KRM.Core.vWebEmailTicket>

@{
    ViewBag.Title = "title";
}
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
    <h4>Link to ticket</h4>
</div>
<div class="modal-body" style="padding-bottom: 0px;">
<table class="table table-fix table-ticket">
    <thead>
        <tr>
            <th></th>
            <th style="text-align: center">ID</th>
            <th>Subject</th>
            <th>Requester</th>
            <th>Requested</th>
            <th>Assigned To</th>
                        <th></th>

        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            var statusClass = "";
            switch (item.StatusID)
            {
                case (int)TicketStatus.New:
                    statusClass = "label-warning";
                    break;
                case (int)TicketStatus.Open:
                    statusClass = "label-important";
                    break;
                case (int)TicketStatus.Pending:
                    statusClass = "label-info";
                    break;
                case (int)TicketStatus.Solved:
                    statusClass = "label-inverse";
                    break;
                case (int)TicketStatus.Closed:
                    statusClass = "";
                    break;
            }
            <tr>
                <td><span class="label @statusClass">@item.Status.Substring(0, 1)</span></td>
                <td style="text-align: center" >#@item.TicketID</td>
                <td>@item.Subject</td>
                <td>@item.EmailFrom</td>
                <td>@string.Format("{0:dd/MM/yyyy}", item.DateAdded)</td>
                <td>@item.AssignToUserName</td>
                <td><a class="btn btn-primary" style="padding-bottom: 2px;padding-top: 2px;" onclick="linkemailtoticket(@item.TicketID,@ViewBag.EmailId)">Link</a></td>
            </tr>
        }
    </tbody>
</table>
    </div>
<div class="modal-footer">
    <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
